/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package org.jackysoft.entity;

import java.util.Set;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.jackysoft.util.MySqlSchema;




/**
 * This is here to persist the historical steps to the historical table.
 *  It is more used more for querying than persistence.
 */
@Entity
@Table(name="os_historystep",schema=MySqlSchema.Businessbase)
public class HibernateHistoryStep extends HibernateStep  {
	
    /**
	 * 
	 */
	private static final long serialVersionUID = 547311976243351663L;
	//~ Constructors ///////////////////////////////////////////////////////////
	public HibernateHistoryStep() {
    }

    public HibernateHistoryStep(HibernateStep step) {
        super(step);
    }

    

    @ElementCollection(fetch=FetchType.EAGER)
	@CollectionTable(name="os_historystep_prev",schema=MySqlSchema.Businessbase, joinColumns = @JoinColumn(name="id"))
	@Cascade({CascadeType.DELETE,CascadeType.SAVE_UPDATE})
	@Column(name = "previous_id")
	public Set<Long> getPreviousSteps() {
		return super.previousSteps;
	}

	@Id	
	public long getId() {
		
		return this.id;
	}
}